import React, { useState } from 'react'
import { Button } from 'antd';
import './del.less'
import { studentsDel,getSliceData } from '../../api/Student'
import { classApi_collageDelete } from '../../api/Grade'
export default function Del(props) {
  let { close, xcon ,fen,setok} = props
  console.log(fen);
  
  return (
    <div>
      <p>你确定要删除这条数据吗?</p>
      <div className="but">
        <Button type="primary" onClick={close}>取消</Button>
       {
         fen=='zhang'? <Button type="primary" onClick={() => {
          classApi_collageDelete({ id: xcon.id }).then(res => {
            console.log(res);
            close()
          })
        }} >确定</Button>:null
       }
       {
         fen=='ma'? <Button type="primary" onClick={() => {
          // props.setok()
          studentsDel({ number: xcon.number }).then(res => {
            console.log(res);
           
            getSliceData({ pageSize: 10, pageNumber: 1}).then((res)=>{
              console.log(res.data.result,123);
              setok()
             
            })
            close()
          })
        }} >确定</Button>:null
       }
      </div>
    </div>
  )
}
